package com.digitalchina.lxnsy.activity.old;

import android.os.Build;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.base.BaseActivity;
import com.digitalchina.lxnsy.entity.CompromanagerVO;

import butterknife.Bind;
import butterknife.ButterKnife;

import static com.digitalchina.lxnsy.constant.URL.URL_INFO_DETAIL;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.activity
 * 创建人：郑皓
 * 创建时间：2018/3/14 17:51
 * 修改备注：
 * ================================================
 */
public class CommonIssueDetailActivity extends BaseActivity {

    @Bind(R.id.web_view)
    WebView webView;
    private CompromanagerVO vo;

    @Override
    public void setLayout() {
        setContentLayout(R.layout.activity_webview);
        setTitle("问题详情");
    }

    @Override
    public void initMember() {
        vo = (CompromanagerVO) getIntent().getSerializableExtra("CompromanagerVO");

        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setPluginState(WebSettings.PluginState.ON);
        webSettings.setUseWideViewPort(true); // 关键点
        webSettings.setAllowFileAccess(true); // 允许访问文件
        webSettings.setSupportZoom(true); // 支持缩放
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); // 不加载缓存内容

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
        }
        webView.getSettings().setUseWideViewPort(true);

        webView.loadUrl(URL_INFO_DETAIL + vo.getId());
    }

    @Override
    public void addListener() {

    }

    @Override
    public void setHandler() {

    }

    @Override
    public void callBack(Object object) {

    }

    @Override
    public void rightOnClick() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
